﻿<!-- #include file="mymin.asp" -->
<card title="内信管理"><p>
<%
w systemMsgRoot

dim id,a,rs,sql,page,link

id=getN("id",0)
a=getN("a",0)
page=getN("page",1)

if a=0 then
	set rs=Server.CreateObject("ADODB.Recordset")
	sql = "select m.id,m.userid,m.savetime,m.content,m.receive,u.name,u0.name as receive_name from (74hu_message m left join 74hu_user u on m.userid=u.id) "&_
		"left join 74hu_user u0 on u0.id=m.receive order by m.id desc"
	rs.open sql,myconn,1,1
	If Not rs.eof Then
		dim pagesize,count,i,pagecount
		PageSize=10
		Count=rs.recordcount
		if page<1 then page=1
		pagecount=(count+pagesize-1)\pagesize
		if page>pagecount then page=pagecount
		rs.move(pagesize*(page-1))
		For i=1 To PageSize
		If rs.eof Then Exit For
			If rs("userid")<>0 Then
				link = "<a href='detail.asp?sid="&sid&"&amp;id="&rs("userid")&"'>"&nowml(rs("name"))&"</a>"
			Else
				link = "系统"
			End If
			If rs("receive")<>0 Then
				link = link&" 给 <a href='detail.asp?sid="&sid&"&amp;id="&rs("receive")&"'>"&nowml(rs("receive_name"))&"</a>"
			End If
			w "[<a href='msgs.asp?sid="&sid&"&amp;id="&rs("id")&"&amp;a=1'>删除</a>]"&link&" ["&forDate2(rs("savetime"))&"]<br/>"&getLeft(nowml(rs("content")),30)&"<br/>"
			rs.moveNext
		Next
		w showPage("msgs.asp", "", page, pageCount)&""
	Else
		w "暂时没有消息！"
	end if
	rs.close
	set rs=nothing
elseif a=1 then
	w "删除信息会影响会员交流，降低体验。你确定删除?<br/>"&_
		"<a href='msgs.asp?sid="&sid&"&amp;id="&id&"&amp;a=2'>确定删除</a><br/>"&_
		"<a href='msgs.asp?sid="&sid&"&amp;page="&page&"'>返回管理</a>"
else
	myconn.execute("delete * from 74hu_message where id="&id)
	w "删除成功!<a href='msgs.asp?sid="&sid&"&amp;page="&page&"'>返回管理</a>"
end if

w "<br/>----------"
call bbsLast
%>